<template>
  <div>
    <breadcrumb></breadcrumb>
    <!-- 分割线 -->
    <el-divider content-position="left">新增商品</el-divider>
    <proform @operation="operation" ></proform>
  </div>
</template>

<script>
import breadcrumb from "@/views/PC/components/breadcrumb.vue";
import proform from "./components/proform.vue";
import httpApi from '@/http';
  export default {
    components: { breadcrumb,proform},
      data(){
        return{
           
          }
      },
      methods:{
           //子组件传递的事件在标签上接收之后可以在methods中直接调用
           //并可以拿到子组件的传递的参数index和rows
           operation(rows) {
                // console.log(rows,'值')
                if(this.$store.state.utype == '2'){
                   rows.store_id = false
                }
                 httpApi.proApi.addPro(rows).then(res=>{
                  //  console.log(res,'添加');
                   if(res.data.code === 200 ){
                     this.$message({
                      message: '恭喜你，新增商品成功',
                      type: 'success'
                    });
                    this.$router.push('/home/pro-list')
                   }else{
                    this.$message({
                      showClose: true,
                      message: '新增商品失败',
                      type: 'error'
                    });
                   }
                 })
               
            }
        
        },


      mounted(){
       
      }
  }
</script>

<style lang="scss" scoped>
// .el-form-item {

// display: inline-block !important;

// }
</style>